<%
'----------------------------------------------------------
'显示问卷排行的函数
'num：排行榜选取的问卷个数
'jiequ：列表显示截取几个字符
'orderby：排行方式,1:有效问卷数2：问卷访问数3：问卷ID
'kind：1：不包括过期的问卷2：包括过期的问卷
'exp:Get_Survey_Paihang(8,14,2,1)
'----------------------------------------------------------
Function Get_Survey_Paihang(num,jiequ,orderby,kind)
Select Case orderby
    Case "1"
	orderway="Survey_usehits"
	Case "2"
	orderway="Survey_hits"
	Case "3"
	orderway="Survey_id"
End Select
Select Case kind
    Case "1"
	sql="select Survey_id,Survey_name from survey where Survey_isOpen=1 and Survey_isAuditing=1 and datediff(Survey_dateOver,now())>0 order by "&orderway&" desc limit "&num&""
	Case "2"
	sql="select Survey_id,Survey_name from survey where Survey_isOpen=1 and Survey_isAuditing=1 order by "&orderway&" desc limit "&num&""
End Select
rs.open sql,conn,1,1
if rs.eof or rs.bof then
	Get_Survey_Paihang="暂时没有问卷"
else
while not rs.eof
if len(rs(1))>cint(jiequ) then
	Get_Survey_Paihang=Get_Survey_Paihang&"<li class=""li""><a href=""Survey_Show.asp?Survey_id="&rs(0)&""" title="&rs(1)&" target=""_blank"">"&left(rs(1),jiequ)&"</a></li>"
else
	Get_Survey_Paihang=Get_Survey_Paihang&"<li class=""li""><a href=""Survey_Show.asp?Survey_id="&rs(0)&""" title="&rs(1)&" target=""_blank"">"&rs(1)&"</a></li>"
end if
rs.movenext
wend
end if
rs.close
End Function

'----------------------------------------------------------
'显示友情链接的函数
'num：友情链接的个数
'width：logo的宽
'height：logo的高
'orderby：排序方式1：按照Id，2：按照添加日期
'kind：1：以文字方式显示链接，2：显示所有有logo的链接
'exp:FriendLink(8,88,31,1,2)
'----------------------------------------------------------
Function FriendLink(num,width,height,orderby,kind)
Select Case orderby
Case "1" 
orderway="Link_id"
Case "2"
orderway="Link_addtime"
End Select
if cint(kind)=1 then
	sql="select Link_name,Link_info,Link_imgurl,Link_url from friendlink where Link_state=1 order by "&orderway&" desc limit "&num&""
	rs.open sql,conn,1,1
	while not rs.eof
	FriendLink=FriendLink&"<div class=""friendBox"">"& vbCrLf
	FriendLink=FriendLink&"<a href="""&rs(3)&""">"&rs(0)&"</a>"
	FriendLink=FriendLink&"</div>"& vbCrLf
	rs.movenext
	wend
	rs.close
else
	sql="select Link_name,Link_info,Link_imgurl,Link_url from friendlink where Link_state=1 and Link_imgurl<>'' order by "&orderway&" desc limit "&num&""
	rs.open sql,conn,1,1
	while not rs.eof
	FriendLink=FriendLink&"<div class=""friendBox"">"& vbCrLf
	FriendLink=FriendLink&"<a href="""& rs(3) &"""><img src="""& rs(2) &""" width="""& width &""" height="""& height &""" alt=""描述："& rs(1) &"""></a>"& vbCrLf
	FriendLink=FriendLink&"<a href="""&rs(3)&""">"&rs(0)&"</a>"& vbCrLf
	FriendLink=FriendLink&"</div>"& vbCrLf
	rs.movenext
	wend
	rs.close
end if
End Function
'----------------------------------------------------------
'最新问卷列表
'num：最新问卷列表的个数
'jiequ：最新问卷列表显示胡截取字符数
'orderby：排行方式,1: Survey_id，问卷ID，2：Survey_creatDate，问卷创建日期
'kind：1：不包括过期的问卷2：包括过期的问卷
'exp:New_Survey_List(8,23,2,1)
'----------------------------------------------------------
Function New_Survey_List(num,jiequ,orderby,kind)
Select Case orderby
Case "1" 
orderway="Survey_id"
Case "2"
orderway="Survey_creatDate"
End Select
if cint(kind)=2 then
sql="select Survey_id,Survey_name from survey where Survey_isOpen=1 and Survey_isAuditing=1 order by "&orderway&" desc limit "&num&""
else
sql="select Survey_id,Survey_name from survey where Survey_isOpen=1 and Survey_isAuditing=1 and datediff(Survey_dateOver,now())>0 order by "&orderway&" desc limit "&num&""
end if
application.lock()
rs.open sql,conn,1,1
if rs.eof or bof then
New_Survey_List="暂时没有问卷"
else
while not rs.eof
	if len(rs(1))>cint(jiequ) then
		New_Survey_List=New_Survey_List&"<li class=""li""><a href=""Survey_Show.asp?Survey_id="&rs(0)&""" target=""_blank"">"&left(rs(1),jiequ)&"</a></li>"& vbCrLf
	else
		New_Survey_List=New_Survey_List&"<li class=""li""><a href=""Survey_Show.asp?Survey_id="&rs(0)&""" target=""_blank"">"&rs(1)&"</a></li>"& vbCrLf
	end if
rs.movenext
wend
end if
application.unlock()
rs.close
End Function

'----------------------------------------------------------
'首页FLASH轮换
'num：轮换数量
'width：宽
'height：高
'text_height：文字高度
'exp:FlashRing(5,250,180,22)
'----------------------------------------------------------
Function FlashRing(num,width,height,text_height)
sql="select Survey_id,Survey_img,Survey_name from survey where Survey_isOpen=1 and Survey_isAuditing=1 and datediff(Survey_dateOver,now())>0 and Survey_img<>'' order by Survey_id desc limit "&num&""
rs.open sql,conn,1,1
FlashRing=FlashRing&"<script type='text/javascript'>"& vbCrLf
FlashRing=FlashRing&"var imgUrl = new Array();"& vbCrLf
FlashRing=FlashRing&"var imgtext = new Array();"& vbCrLf
FlashRing=FlashRing&"var imgLink = new Array();"& vbCrLf
dim i:i=0
while not rs.eof
FlashRing=FlashRing&"imgUrl["&i&"]='"&rs(1)&"';"& vbCrLf
FlashRing=FlashRing&"imgLink["&i&"]='Survey_Show.asp?Survey_id="&rs(0)&"';"& vbCrLf
FlashRing=FlashRing&"imgtext["&i&"]='"&rs(2)&"';"& vbCrLf
i=i+1
rs.movenext
wend
FlashRing=FlashRing&"var pics=imgUrl[0];"& vbCrLf
FlashRing=FlashRing&"var links=imgLink[0];"& vbCrLf
FlashRing=FlashRing&"var texts=imgtext[0];"& vbCrLf
FlashRing=FlashRing&"for(var i=1;i<imgUrl.length;i++){"& vbCrLf
FlashRing=FlashRing&"	pics+='|'+imgUrl[i];"& vbCrLf
FlashRing=FlashRing&"	links+='|'+imgLink[i];"& vbCrLf
FlashRing=FlashRing&"	texts+='|'+imgtext[i];"& vbCrLf
FlashRing=FlashRing&"}"& vbCrLf
FlashRing=FlashRing&"var focus_width="&width&";"& vbCrLf
FlashRing=FlashRing&"var focus_height="& height &";"& vbCrLf
FlashRing=FlashRing&"var text_height="&text_height&";"& vbCrLf
FlashRing=FlashRing&"var swf_height = focus_height+text_height;"& vbCrLf

FlashRing=FlashRing&"document.write('<object classid=""clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"" codebase=""http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"" width=""'+ focus_width +'"" height=""'+ swf_height +'"">');"& vbCrLf
FlashRing=FlashRing&"document.write('<param name=""allowScriptAccess"" value=""sameDomain"" /><param name=""movie"" value=""Flash/rollpic.swf"" /><param name=""quality"" value=""high"" /><param name=""bgcolor"" value=""#F0F0F0"">');"& vbCrLf
FlashRing=FlashRing&"document.write('<param name=""menu"" value=""0""><param name=wmode value=""opaque"">');"& vbCrLf
FlashRing=FlashRing&"document.write('<param name=""FlashVars"" value=""pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'"">');"& vbCrLf
FlashRing=FlashRing&"document.write('<embed src=""Flash/rollpic.swf"" wmode=""opaque"" FlashVars=""pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'"" menu=""0"" bgcolor=""#F0F0F0"" quality=""high"" width=""'+ focus_width +'"" height=""'+ focus_height +'"" allowScriptAccess=""sameDomain"" type=""application/x-shockwave-flash"" pluginspage=""http://www.macromedia.com/go/getflashplayer"" />');"& vbCrLf
FlashRing=FlashRing&"document.write('</object>');"& vbCrLf
FlashRing=FlashRing&"</script>"& vbCrLf
rs.close
End Function


Function Templet_change(Templet_id)
  if isnumeric(Templet_id) and Templet_id>0 then
    sql="select * from templet where Templet_column=8 and Templet_id=" & Templet_id
	rs.open sql,conn,1,3
	if not rs.eof then
	  Templet_change=rs("Templet_content")
	else
	  Templet_change=""
	end if
	rs.close
  else
    Templet_change=""
  end if
End Function

'----------------------------------------------------------
'问卷列表
'num：分页每个页多少条记录
'orderby：排序方式1：按照Id，2：按照添加日期，3：问卷访问数: 4：有效问卷数
'kind：1：不包括过期的问卷2：包括过期的问卷
'exp：Survey_List(10,3,1)
'----------------------------------------------------------
Function Survey_List(num,orderby,kind)
Select Case orderby
Case 1 
orderway="Survey_id"
Case 2
orderway="Survey_creatDate"
Case 3
orderway="Survey_hits"
Case 4
orderway="Survey_usehits"
End Select
Survey_List="<table width=""100%"" align=""center"" cellpadding=""0"" cellspacing=""0"" id=""SurveyAdmin"" class=""table"">"
dim  sql,page_size,rscount,item_count,page_num,page_now,i
page_size=num
set rscount=conn.execute("select count(*) as item_count from survey where Survey_isOpen=1 and Survey_isAuditing=1 and datediff(Survey_dateOver,now())>0")
	item_count=cint(rscount("item_count"))
	rscount.close
    page_num=item_count\page_size
if 	cint(kind)=2 then
sql="select * from survey where Survey_isOpen=1 and Survey_isAuditing=1 order by "& orderway &" desc"
else
sql="select * from survey where Survey_isOpen=1 and Survey_isAuditing=1 and datediff(Survey_dateOver,now())>0 order by "& orderway &" desc"
end if
rs.CursorLocation = 3
rs.open sql,conn,1,3
if not rs.eof then
	rs.pagesize=page_size
	page_now=1
	if trim(request.QueryString("page"))<>"" then
	page_now=cint(trim(request.QueryString("page")))
	end if
	if page_now>rs.pagecount or page_now<0 then
	page_now=1
	end if
	rs.absolutepage=page_now
Survey_List=Survey_List&"<tr>"
Survey_List=Survey_List&"<td>问卷名称</td>"
Survey_List=Survey_List&"<td>问卷发起者</td>"
Survey_List=Survey_List&"<td>问卷创建日期</td>"
Survey_List=Survey_List&"<td>问卷结束日期</td>"
Survey_List=Survey_List&"<td>浏览数</td>"
Survey_List=Survey_List&"</tr>"
  i=1
  while not rs.eof and i<page_size+1
Survey_List=Survey_List&"<tr>"
Survey_List=Survey_List&"<td align=""left"" style=""text-align:left""><a href=""Survey_Show.asp?Survey_id="&rs("Survey_id")&""">"&rs("Survey_name")&"</a></td>"
Survey_List=Survey_List&"<td>"&rs("Survey_author")&"</td>"
Survey_List=Survey_List&"<td>"&rs("Survey_creatDate")&"</td>"
Survey_List=Survey_List&"<td>"&rs("Survey_dateOver")&"</td>"
Survey_List=Survey_List&"<td>"&rs("Survey_hits")&"</td>"
Survey_List=Survey_List&"</tr>"
   rs.movenext
   i=i+1
   wend
Survey_List=Survey_List&"<tr>"
Survey_List=Survey_List&"<td colspan=""5"" align=""right"">"
Survey_List=Survey_List&"<div id=""bottom_pagebox"" style=""padding-right:25px; text-align:right;"">"
Survey_List=Survey_List&pageBox("Survey_list.asp?","个问卷",item_count,page_now,rs.pagecount)
Survey_List=Survey_List&"</div>"
  
Survey_List=Survey_List&"  </td>"
Survey_List=Survey_List&"</tr>"
else
Survey_List=Survey_List&"<tr>"
Survey_List=Survey_List&"<td colspan=""5"">暂时没有问卷!</a></td>"
Survey_List=Survey_List&"</tr>"
end if
rs.close
Survey_List=Survey_List&"</table>"
End Function


'----------------------------------------------------------
'留言显示页
'num：分页每个页多少条记录
'exp：Guest_Book_List(10)
'----------------------------------------------------------
Function Guest_Book_List(num,page_now)
page_size=cint(num)
set rscount=conn.execute("select count(*) as item_count from guestbook")
	item_count=rscount("item_count")
	rscount.close
    page_num=item_count\page_size 
sql="select * from guestbook order by GB_date desc"
rs.open sql,conn,1,3
if not rs.eof then
	rs.pagesize=page_size
	if cint(page_now)>rs.pagecount or cint(page_now)<0 then
	page_now=1
	end if
	rs.absolutepage=cint(page_now)
	i=1
	while not rs.eof and i<page_size+1
Guest_Book_List=Guest_Book_List&"<table width=""758"" cellpadding=""0"" cellspacing=""0"" id=""guestBook"">"
Guest_Book_List=Guest_Book_List&"<tr>"
Guest_Book_List=Guest_Book_List&"<td width=""13%"" rowspan=""2"" valign=""top"" class=""touXiang""><img src=""Images/nobody.gif"" vspace=""0"" align=""bottom"" />"
Guest_Book_List=Guest_Book_List&"<div class=""name"">"&rs("GB_user")&"</div>"
Guest_Book_List=Guest_Book_List&"</td>"
Guest_Book_List=Guest_Book_List&"<td width=""87%"" height=""50"" class=""guestBookContetn"">"&rs("GB_content")&"</td>"
Guest_Book_List=Guest_Book_List&"</tr>"
Guest_Book_List=Guest_Book_List&"<tr>"
Guest_Book_List=Guest_Book_List&" <td height=""20"" class=""info"">时间："&rs("GB_date")&"&nbsp;&nbsp;"
    if not rs("GB_email")="" then
    Guest_Book_List=Guest_Book_List& "<a href=""mailto:"&rs("GB_email")&"""><img src=""Images/email.gif""/></a>&nbsp;&nbsp;"
    end if
    if not rs("GB_qq")="" then 
    Guest_Book_List=Guest_Book_List& "<a href=""tencent://message/?uin="&rs("GB_qq")&"&Site="&siteName&"&Menu=yes""><img src=""Images/qq.gif""/></a>"
    end if
Guest_Book_List=Guest_Book_List&"  </td>"
Guest_Book_List=Guest_Book_List&"</tr>"
Guest_Book_List=Guest_Book_List&"</table>"
	i=i+1
	rs.movenext
	wend
else
Guest_Book_List=Guest_Book_List&"<table width=""758"" align=""center"" cellpadding=""0"" cellspacing=""0"" id=""guestBook"" class=""table"">"
Guest_Book_List=Guest_Book_List&"<tr>"
Guest_Book_List=Guest_Book_List&"<td>暂时没有留言，请添加</a></td>"
Guest_Book_List=Guest_Book_List&"</tr>"
Guest_Book_List=Guest_Book_List&"</table>"
end if
Guest_Book_List=Guest_Book_List&"<table width=""758"" align=""center"" cellpadding=""0"" cellspacing=""0"" id=""guestBook"" class=""table"">"
Guest_Book_List=Guest_Book_List&"<tr>"
Guest_Book_List=Guest_Book_List&"<td align=""right"">"
Guest_Book_List=Guest_Book_List&"<div id=""bottom_pagebox"" style=""padding-right:25px; text-align:right;"">"
Guest_Book_List=Guest_Book_List&pageBox("Guest_Book.asp?","条留言",item_count,page_now,rs.pagecount)
Guest_Book_List=Guest_Book_List&"</div>"
Guest_Book_List=Guest_Book_List&"</td>"
Guest_Book_List=Guest_Book_List&"</tr>"
Guest_Book_List=Guest_Book_List&"</table>"
rs.close
End Function

'----------------------------------------------------------
'友情链接列表
'num：分页每个页多少条记录
'orderby:排序方式
'exp：Guest_Book_List(10)
'----------------------------------------------------------
Function Friend_List(num,orderby)
Select Case orderby
Case 1 
orderway="Link_id"
Case 2
orderway="Link_addtime"
End Select
Friend_List=Friend_List&"<table cellSpacing=0 cellPadding=0 width=740 border=0>"
Friend_List=Friend_List&"<tbody>"
Friend_List=Friend_List&"<tr>"
Friend_List=Friend_List&"<td width=""123"">序号</td>"
Friend_List=Friend_List&"<td width=""150"">链接名称</td>"
Friend_List=Friend_List&"<td width=""149"">链接地址</td>"
Friend_List=Friend_List&"<td width=""220"">LOGO</td>"
Friend_List=Friend_List&"<td width=""110"">链接备注</td>"
Friend_List=Friend_List&"</tr>"
    dim page_size,rscount,item_count,page_num,page_now,i
    page_size=10
    set rscount=conn.execute("select count(*) as item_count from friendlink")
        item_count=rscount("item_count")
        rscount.close
        page_num=item_count\page_size 
    sql="select * from friendlink order by Link_id desc"
    rs.open sql,conn,1,3
    if not rs.eof then
		rs.pagesize=page_size
        page_now=1
        if trim(request.QueryString("page"))<>"" then
        page_now=cint(trim(request.QueryString("page")))
        end if
        if page_now>rs.pagecount or page_now<0 then
        page_now=1
        end if
        rs.absolutepage=page_now
        i=1
        while not rs.eof and i<page_size+1
Friend_List=Friend_List&"<tr>"
Friend_List=Friend_List&"<td>"&i&"</td>"
Friend_List=Friend_List&"<td class=""tdLeft""><a href="""&rs("Link_url")&""" target=""_blank"">"&rs("Link_name")&"</a></td>"
Friend_List=Friend_List&"<td class=""tdLeft""><a href="""&rs("Link_url")&""" target=""_blank"">"&rs("Link_url")&"</a></td>"
Friend_List=Friend_List&"<td><img src="""&rs("Link_imgurl")&""" height=""31"" width=""88""/></td>"
Friend_List=Friend_List&"<td>"&rs("Link_info")&"</td>"
Friend_List=Friend_List&"</tr>"
		rs.movenext
		i=i+1
		wend
Friend_List=Friend_List&"<tr>"
Friend_List=Friend_List&"<td colspan=""5"" align=""right"" height=""30px"">"
Friend_List=Friend_List&"<div id=""bottom_pagebox"" style=""padding-right:50px; text-align:right"">"
Friend_List=Friend_List&pageBox("Friend_List.asp?","个友情链接",item_count,page_now,rs.pagecount)
Friend_List=Friend_List&"</div>"
Friend_List=Friend_List&"</td>"
Friend_List=Friend_List&"</tr>"
    else
Friend_List=Friend_List&"<tr>"
Friend_List=Friend_List&"<td colspan=""5"">暂时没有友情链接，请<a href=""FriendLinkAdd.asp"">添加</a></td>"
Friend_List=Friend_List&"</tr>"
    end if
    rs.close
Friend_List=Friend_List&"</tbody>"
Friend_List=Friend_List&"</table>"
End Function
%>